package com.haibo.utils;

import com.alibaba.fastjson2.JSON;
import com.haibo.entity.dto.ThreeLevelCardControlReminderDTO;
import com.haibo.entity.dto.ThreeLevelCardControlReminderItemDTO;
import com.haibo.entity.model.ThreeLevelCardControlReminderDO;
import lombok.extern.slf4j.Slf4j;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

/**
 * @Author : 刘海波
 * @Date: 2025-09-22 23:06
 * @Description: 【三级卡控-消息提醒】工具类
 */
@Slf4j
public class ThreeLevelCardControlReminderUtil {

    /**
     * 构建[三级卡控-消息提醒]
     * @param msgList
     * @param param
     * @return
     */
    public static List<ThreeLevelCardControlReminderDO> buildThreeLevelCardControlReminder(List<ThreeLevelCardControlReminderItemDTO> msgList, ThreeLevelCardControlReminderDTO param) {
        log.debug("构建[三级卡控-消息提醒]param：{}", JSON.toJSONString(msgList));
        List<ThreeLevelCardControlReminderDO> threeLevelCardControlReminderDOS = new ArrayList<>();
        ThreeLevelCardControlReminderDO threeLevelCardControlReminderDO = null;
        for (ThreeLevelCardControlReminderItemDTO e : msgList) {
            threeLevelCardControlReminderDO = new ThreeLevelCardControlReminderDO()
                    .setId(SnowflakeIdGeneratorUtil.getInstance(1L).nextId())
                    .setCaseHistoryId(param.getCaseHistoryId())
                    .setReservationNo(param.getReservationNo())
                    .setScene(param.getScene())
                    .setVisitId(param.getVisitId())
                    .setPatientId(param.getPatientId())
                    .setLevel(e.getLevel())
                    .setTypeId(e.getTypeId())
                    .setQuesNum(e.getQuesNum())
                    .setIsRead(0)
                    .setCreateTime(LocalDateTime.now())
                    .setUpdateTime(LocalDateTime.now())
                    .setStatus(0);
            threeLevelCardControlReminderDOS.add(threeLevelCardControlReminderDO);
        }

        return threeLevelCardControlReminderDOS;
    }
}
